package com.wn;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
public class LetterController {

    @Autowired
    RabbitTemplate rabbitTemplate;

    @ResponseBody
    @RequestMapping("/let")
    public void letter(){

        String email = "lqy01237@gmail.com";
        String subject = "测试邮件";
        String text = "测试邮件内容:小心电信诈骗，小心移动支付陷阱，小心联通电信的移动支付陷阱";
        String leihou = "雷猴啊";

        Map<String, String> emailLetter = new HashMap<>();
        emailLetter.put("email", email);
        emailLetter.put("subject", subject);
        emailLetter.put("text", text);

        rabbitTemplate.convertAndSend("direct_exchangeA", "email" , emailLetter);
        rabbitTemplate.convertAndSend("direct_exchangeA", "dleter" , leihou);

    }

}
